package com.google.android.gms.internal;

import java.util.ArrayList;
import java.util.List;

@zzabh
public final class zzajn {
    private final String[] zzdgp;
    private final double[] zzdgq;
    private final double[] zzdgr;
    private final int[] zzdgs;
    private int zzdgt;

    private zzajn(zzajq zzajq) {
        int size = zzajq.zzdgy.size();
        this.zzdgp = (String[]) zzajq.zzdgx.toArray(new String[size]);
        this.zzdgq = zzr(zzajq.zzdgy);
        this.zzdgr = zzr(zzajq.zzdgz);
        this.zzdgs = new int[size];
        this.zzdgt = 0;
    }

    private static double[] zzr(List<Double> list) {
        double[] dArr = new double[list.size()];
        for (int i = 0; i < dArr.length; i++) {
            dArr[i] = list.get(i).doubleValue();
        }
        return dArr;
    }

    public final List<zzajp> getBuckets() {
        ArrayList arrayList = new ArrayList(this.zzdgp.length);
        for (int i = 0; i < this.zzdgp.length; i++) {
            arrayList.add(new zzajp(this.zzdgp[i], this.zzdgr[i], this.zzdgq[i], ((double) this.zzdgs[i]) / ((double) this.zzdgt), this.zzdgs[i]));
        }
        return arrayList;
    }

    public final void zza(double d) {
        this.zzdgt++;
        int i = 0;
        while (i < this.zzdgr.length) {
            if (this.zzdgr[i] <= d && d < this.zzdgq[i]) {
                int[] iArr = this.zzdgs;
                iArr[i] = iArr[i] + 1;
            }
            if (d >= this.zzdgr[i]) {
                i++;
            } else {
                return;
            }
        }
    }
}
